package com.hd.tiyu.yuejian.Activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.hd.tiyu.yuejian.JavaBean.YueJianIntro;
import com.hd.tiyu.yuejian.Model.ListsModel;
import com.hd.tiyu.yuejian.R;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * Created by love on 2017/10/23.
 */

public class YueJianIntroActivity extends AppCompatActivity {
    private ImageView back_img,yuejian_img;
    private TextView mingyan,intro;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.yuejiantinro);
        initViews();
        initEvents();
        initData();
    }

    private void initViews() {
        back_img=(ImageView)findViewById(R.id.back);
        yuejian_img=(ImageView)findViewById(R.id.imag);
        mingyan=(TextView)findViewById(R.id.tex_mingyan);
        intro=(TextView)findViewById(R.id.tex_intro);

    }

    private void initEvents() {
       back_img.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
               finish();
           }
       });


    }

    private void initData() {
        ListsModel listsModel=new ListsModel();
        Call<YueJianIntro>call=listsModel.Intro();
        call.enqueue(new Callback<YueJianIntro>() {
            @Override
            public void onResponse(Call<YueJianIntro> call, Response<YueJianIntro> response) {
                YueJianIntro data=response.body();
                mingyan.setText(data.getCorpname());
                intro.setText(data.getContact());
               // Picasso.with(YueJianIntroActivity.this).load("http://172.24.10.175/workout/Uploads/"+data.getLogo()).resize(350,150).centerCrop().into(yuejian_img);
            }
            @Override
            public void onFailure(Call<YueJianIntro> call, Throwable t) {

            }
        });
    }

}
